//Source file: D:\\test\\com\\ce\\pms\\charge\\model\\BankAccountDomain.java

package com.ce.pms.charge.model;

import java.util.Date;
import javax.persistence.*;
import com.ce.pms.common.model.SysInfo;
import com.ce.pms.customer.model.ProRightDO;
import com.ce.pms.exception.BusinessException;
import com.ce.pms.house.model.HouseDomain;
import com.ce.util.BlankUtil;
import com.sitechasia.webx.core.model.IDomainObject;

/**
 * 实体名称:银行划款帐号 关联数据表:FEE_BANK_ACCOUNT
 */

@Entity
@Table(name = "FEE_BANK_ACCOUNT")
public class BankAccountDomain implements IDomainObject{

	/**
	 * 关键字
	 */
	@Id
	@GeneratedValue
	@Column(name = "BANK_ACCOUNT_ID", nullable = false)
	private Long keyword;

	/**
	 * 房屋
	 */
	@ManyToOne(cascade = {},fetch = FetchType.LAZY)
	@JoinColumn(name = "HOUSE_ID")
	private HouseDomain house;

	/**
	 * 产权
	 */
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PRO_RIGHT_ID")
	private ProRightDO proRight;

	/**
	 * 开户银行
	 */
	@ManyToOne(cascade={},fetch = FetchType.LAZY)
	@JoinColumn(name = "BANK_ID")
	private BankDomain bank;

	/**
	 * 银行帐号
	 */
	@Column(name = "ACC_NUMBER", length = 20, nullable = false)
	private String accNumber;

	/**
	 * 开户人
	 */
	@Column(name = "ACC_OWNER", length = 32)
	private String accOwner;

	/**
	 * 合同号
	 */
	@Column(name = "CONTRACT_NUMBER", length = 100)
	private String contactNumber;

	/**
	 * 是否有效
	 */
	@Column(name = "IS_ACTIVE", length = 1, nullable = false)
	private String isActive;

	/**
	 * 停用时间
	 */
	@Column(name = "STOP_DATE")
	@Temporal(TemporalType.TIMESTAMP)
	private Date stopDate;

	/**
	 * 系统信息
	 */
	@Embedded
	private SysInfo sysInfo;

	/**
	 * @roseuid 48757D100232
	 */
	public BankAccountDomain() {

	}

	/**
	 * mini construct
	 * @param house 房屋
	 * @param proRight 产权
	 * @param bank 开户银行
	 * @param accNumber 银行帐号
	 * @param accOwner 开户人
	 * @param contactNumber 合同号
	 * @param isActive 是否有效
	 * @param sysInfo 系统信息
	 */
	public BankAccountDomain(HouseDomain house, ProRightDO proRight, BankDomain bank, String accNumber, String accOwner, String contactNumber, String isActive, SysInfo sysInfo) {
		this.house = house;
		this.proRight = proRight;
		this.bank = bank;
		this.accNumber = accNumber;
		this.accOwner = accOwner;
		this.contactNumber = contactNumber;
		this.isActive = isActive;
		this.sysInfo = sysInfo;
	}




	public String getAccNumber() {
		return accNumber;
	}

	public void setAccNumber(String accNumber) {
		this.accNumber = accNumber;
	}

	public String getAccOwner() {
		return accOwner;
	}

	public void setAccOwner(String accOwner) {
		this.accOwner = accOwner;
	}

	public BankDomain getBank() {
		return bank;
	}

	public void setBank(BankDomain bank) {
		this.bank = bank;
	}

	public String getContactNumber() {
		return contactNumber;
	}

	public void setContactNumber(String contactNumber) {
		this.contactNumber = contactNumber;
	}

	public HouseDomain getHouse() {
		return house;
	}

	public void setHouse(HouseDomain house) {
		this.house = house;
	}

	public String getIsActive() {
		return isActive;
	}

	public void setIsActive(String isActive) {
		this.isActive = isActive;
	}

	public Long getKeyword() {
		return keyword;
	}

	public void setKeyword(Long keyword) {
		this.keyword = keyword;
	}

	public ProRightDO getProRight() {
		return proRight;
	}

	public void setProRight(ProRightDO proRight) {
		this.proRight = proRight;
	}

	public Date getStopDate() {
		return stopDate;
	}

	public void setStopDate(Date stopDate) {
		this.stopDate = stopDate;
	}

	public SysInfo getSysInfo() {
		return sysInfo;
	}

	public void setSysInfo(SysInfo sysInfo) {
		this.sysInfo = sysInfo;
	}

	/**
	 * 功能描述: 检查必填字段 <br>
	 *
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-8-25  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public void checkRequiredField(){
		if (this.bank == null
				|| this.proRight == null
				|| this.house == null
				|| BlankUtil.isBlank(this.accNumber)
				|| BlankUtil.isBlank(this.isActive)
				|| this.sysInfo == null
				|| this.sysInfo.getCreator()==null
				|| this.sysInfo.getSysDate()==null) {
			throw new BusinessException("common:mustFill_null_exception",
					BusinessException.WARNING);
		}
	}
}
